"""
    Core.py - This handles misc. functions
    Copyright (C) 2009  Matthew Baldwin <secretagentcook@gmail.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>
"""

import CommandList
import Login
import Player



class Handler(object):
    """ The class to handle all player input. """
    
    def input_handler(self, input):
        self.input = input
        self.login_state = Player.Player.info['login_state']
        
        self.input = self.input.replace('\r', '')
        
        if self.login_state == 1:
            Login.Login.player_check(self.input)
            
        elif self.login_state == 11:
            Login.Login.check_pass(self.input)
            
        elif self.login_state == 12:
            Login.Login.player_create(self.input)
            
        elif self.login_state == 13:
            Login.Login.create_pass(self.input)

        
        elif self.login_state == 2:
            self.word = []

            self.word = self.input
            CommandList.command_list.commands(word[0], word[1], word[2])

        else:
            pass
        

class Const(object):
    """ Handles MUD wide constants.  You should only have to configure the
        variables in this section and not have to go searching. """

    #Port Number
    port = 1234

    #People Logged In
    players = {}

    #Login States
    loggin_in = 1
    checking_pass = 11
    creating_name = 12
    creating_pass = 13
    
    logged_in = 2
    
    #database type
    db_type = 'file'

    
class World(object):
    """ Handles all the World functions """
    #TODO:  This is more of a place holder at the moment

    def __init__(self):
        pass

    



Handler = Handler()
